import moment from 'moment';
import Service from '../../mock/Service'
export class ProfileFinder implements Finder<Profile> {
    private _profiles: Profile[] = []
    private _profileKeywords: keywordsOf<Profile> = {
        availability: {
            availableDate: moment().add(3, 'month').format('YYYY-MM-DD')
        },
        profession: {
            experience: [0, 8],
            tags: []
        },
        education: {
            diploma: ['大专', '大本']
        }
    }

    get profiles(): Profile[] {
        return this._profiles
    }

    get keywords(): keywordsOf<Profile> {
        return this._profileKeywords
    }

    async find(keywords?: keywordsOf<Profile>): Promise<ServiceReturnList<Profile>> {
        if (keywords)
            this._profileKeywords = keywords

        const response = await Service.findProfiles(this._profileKeywords)
        this._profiles = response.data
        return response
    }
}